testing: fix finding tests on new cmake versions
authorChristian Tismer <tismer@stackless.com>
Tue, 20 May 2025 13:25:38 +0000 (15:25 +0200)
committerDmitry Shachnev <mitya57@debian.org>
Tue, 20 Jan 2026 21:26:54 +0000 (00:26 +0300)
By chance, cmake was installed by homebrew without any restrictions,
and so version 4.0.2 happened to be installed which does no longer
use the option "--force-new-ctest-process". Changed the analysis to
look for "/bin/ctest" instead. This should work for a long time.

Task-number: PYSIDE-2221
Change-Id: Idc16063953ba82d4053cc60a7e0ef11b71b7b571
Pick-to: 6.9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 03de4672557d80b34f9c9ef1e654a4117c621e65)

Gbp-Pq: Name testing-fix-finding-tests-on-new-cmake-versions.patch

testing/runner.py

index 83b7b08e6f8b56eeacfc2209bdcdaf899e7babee..43aaee0d76dcdf2fc2a0fa04d4dbeabb8ed49817 100644 (file)
@@ -93,7 +93,8 @@ class TestRunner(object):
         Helper for _find_ctest() that finds the ctest binary in a build
         system file (ninja, Makefile).
         """
-        look_for = "--force-new-ctest-process"
+        # Looking for a command ending this way:
+        look_for = "\\ctest.exe" if "win32" in sys.platform else "/ctest"
         line = None
         with open(file_name) as makefile:
             for line in makefile:
@@ -111,7 +112,8 @@ class TestRunner(object):
                 raise RuntimeError(msg)
         # the ctest program is on the left to look_for
         assert line, "Did not find {}".format(look_for)
-        ctest = re.search(r'(\S+|"([^"]+)")\s+' + look_for, line).groups()
+        look = re.escape(look_for)
+        ctest = re.search(fr'(\S+{look}|"([^"]+{look})")', line).groups()
         return ctest[1] or ctest[0]
 
     def _find_ctest(self):